package com.bgIntlgn.client.entity.manufacture;

import java.util.Date;

import yuhuibear.poat.annotations.action.AutoGenerateValue;
import yuhuibear.poat.annotations.relation.Field;
import yuhuibear.poat.annotations.relation.Table;
import yuhuibear.poat.object.bean.Bean;

/**
 * 生产计划条目, 属于零件级别的。
 * 
 * @author yuhui
 * 
 */
@Table(name = "production_iterms", constrain = "")
public class ProductionIterm implements Bean {

	@AutoGenerateValue(skipOnNull = true, sqlToGet = "select currval('production_iterms_id_seq')")
	@Field(name = "id", type = "bigserial", constrain = "primary key ")
	private Long id;

	@Field(name = "plan_id", type = "int8 ", constrain = " not null references production_plans(id)  on update cascade on delete cascade")
	private Long planId;

	/**
	 * 分解时填写的计划条目预计结束时间
	 */
	@Field(name = "dead_line", type = "timestamp", constrain = "")
	private Date deadLine;

	/**
	 * 可能来自分解， 也可能直接来自订单
	 */
	@Field(name = "uid", type = "char(80)", constrain = " not null references element_subversions(uid) on update cascade ")
	private String uid;

	/**
	 * 表示图纸就绪状态
	 */
	@Field(name = "paper_prepared", type = "boolean ", constrain = "default false")
	private boolean paperPrepared;

	/**
	 * 表示当前条目对应的订单条目
	 */
	@Field(name = "order_cargo_id", type = "int8 ", constrain = " references order_cargos(id)  on update cascade on delete cascade")
	private Long orderCargoId;

	/**
	 * 已备料数量<BR>
	 * 派工基于该数量
	 */
	@Field(name = "prepared", type = "int", constrain = "not null default 0")
	private Integer prepared;

	/**
	 * 已生产数量<BR>
	 * 需要入库逻辑更新.
	 */
	@Field(name = "produced_quantity", type = "int", constrain = "not null default 0")
	private Integer producedQuantity;

	/**
	 * 计划生产数量
	 */
	@Field(name = "plan_quantity", type = "int", constrain = "default 0")
	private Integer planQuantity;

	/**
	 * 订单所需总数量
	 */
	@Field(name = "total_quantity", type = "int", constrain = "not null default 0")
	private Integer totalQuantity;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getPlanId() {
		return planId;
	}

	public void setPlanId(Long planId) {
		this.planId = planId;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public boolean isPaperPrepared() {
		return paperPrepared;
	}

	public void setPaperPrepared(boolean paperPrepared) {
		this.paperPrepared = paperPrepared;
	}

	public Long getOrderCargoId() {
		return orderCargoId;
	}

	public void setOrderCargoId(Long orderCargoId) {
		this.orderCargoId = orderCargoId;
	}

	public Integer getPrepared() {
		return prepared;
	}

	public void setPrepared(Integer prepared) {
		this.prepared = prepared;
	}

	public Integer getProducedQuantity() {
		return producedQuantity;
	}

	public void setProducedQuantity(Integer producedQuantity) {
		this.producedQuantity = producedQuantity;
	}

	public Integer getPlanQuantity() {
		return planQuantity;
	}

	public void setPlanQuantity(Integer planQuantity) {
		this.planQuantity = planQuantity;
	}

	public Integer getTotalQuantity() {
		return totalQuantity;
	}

	public void setTotalQuantity(Integer totalQuantity) {
		this.totalQuantity = totalQuantity;
	}

	public Date getDeadLine() {
		return deadLine;
	}

	public void setDeadLine(Date deadLine) {
		this.deadLine = deadLine;
	}

}
